<?php 
if(isset($data) AND isset($data['fields'])):
 ?>
<div class="facet">
<h2>Facet: query for <?php h($data['head']['query']) ?></h2>
<dl class="facet">
<?php foreach($data['fields'] as $k => $row): ?>
	<dt><?php h($k) ?></dt>
	<?php foreach($row as $item): ?>
		<dd>
			<a href="/?data-uri=<?php echo urlencode($item['facet_uri']) ?>&amp;output=html"><?php h($item['value']) ?></a>
			(<?php h($item['number']) ?>)
			<div>
				<a href="/?data-uri=<?php echo urlencode($item['search_uri']) ?>&amp;output=html">Search</a>
			</div>
		</dd> 
	<?php endforeach ?>
<?php endforeach ?>
</dl>
</div>
<?php endif ?>